﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using Microsoft.Phone.Controls;
using Microsoft.Phone.Tasks;
using Coding4Fun.Phone.Controls;
using System.Windows.Media.Imaging;

namespace YiDingCanWp7
{
    public partial class SettingsPage : PhoneApplicationPage
    {
        public SettingsPage()
        {
            InitializeComponent();
        }
        protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e)
        {
            if (BaseConfig.IsLogined)
            {
                button_Logout.Visibility = Visibility.Visible;
            }
            else
            {
                button_Logout.Visibility = Visibility.Collapsed;
            }
            base.OnNavigatedTo(e);
        }
        private void MaketplaceReview_Click(object sender, RoutedEventArgs e)
        {
            MarketplaceReviewTask reviewTask = new MarketplaceReviewTask();
            reviewTask.Show();
        }

        private void button_Logout_Click(object sender, RoutedEventArgs e)
        {
            BaseConfig.IsLogined = false;
            button_Logout.Visibility = Visibility.Collapsed;
            ToastPrompt toast = new ToastPrompt(); //实例化 
            toast.Title = "退出成功"; //设置标题 
            toast.FontSize = 30; //设置文本大小(可选) 
            toast.TextOrientation = System.Windows.Controls.Orientation.Vertical; //设置呈现为纵向 
            toast.Background = new SolidColorBrush(Colors.LightGray); //背景色(可选) 
            toast.Foreground = new SolidColorBrush(Colors.Red); //前景色(可选)
            toast.Completed += toast_Completed; //Toast显示完毕后触发事件(可选) 
            toast.Show();
        }
        void toast_Completed(object sender, PopUpEventArgs<string, PopUpResult> e)
        {
        }
    }
}